

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "boards.h"
//#include "EPAPER.h"
//#include "picture.h"
#include "epd_ses_266.h"

char buf[100];

void EPD_PinConfig(void) {
    nrf_gpio_cfg_input(EPD_BUSY, NRF_GPIO_PIN_PULLUP);
    
  //  nrf_gpio_cfg_output(EPD_CTL);
    nrf_gpio_cfg_output(EPD_BS);

    nrf_gpio_cfg_output(EPD_RST);
    nrf_gpio_cfg_output(EPD_DC);
    nrf_gpio_cfg_output(EPD_CS);
    nrf_gpio_cfg_output(EPD_SCLK);
    nrf_gpio_cfg_output(EPD_SDI);
    
   // nrf_gpio_pin_set(EPD_CTL); // EPD Power ON
    nrf_gpio_pin_clear(EPD_BS); // 4-Wire SPI
}

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    /* Configure board. */
  //  bsp_board_leds_init();
    
    EPD_PinConfig();
    
    EPD_2IN66_Init();
    EPD_2IN66_Clear();
    EPD_2IN66_Init_Partial();
 //   EPD_DrawFonts(116 + 5, 1, 10, ":", (const epdFONT_ascii *)&Ascii_DigitalDismay_47X80, NULL, NEW_RAM | OLD_RAM);
  
    sprintf(buf, "%02d", 21);
    EPD_DrawFonts(0, 0, 10, buf, (const epdFONT_ascii *)&Ascii_DigitalDismay_47X80, NULL, NEW_RAM | OLD_RAM);
    
  //  sprintf(buf, "%02d", 47);
   // EPD_DrawFonts(155 + 5, 1, 10, buf, (const epdFONT_ascii *)&Ascii_DigitalDismay_47X80, NULL, NEW_RAM | OLD_RAM);
    
    //static struct Lunar_Date Lunar;
   // LUNAR_SolarToLunar(&Lunar, (uint16_t)(23 + 2000), 2, 27);
    sprintf(buf, "2025-04-28");

    EPD_DrawFonts(8, 10, 1, buf, (const epdFONT_ascii *)&Ascii_YouYuan_8x16, (const epdFONT_utf8 *)&utf8_CN_16x16, NEW_RAM | OLD_RAM);

    EPD_2IN66_TurnOnDisplay();
    EPD_2IN66_Sleep();
    
    /* Toggle LEDs. */
    while (true)
    {
        for (int i = 0; i < LEDS_NUMBER; i++)
        {
       //     bsp_board_led_invert(i);
            nrf_delay_ms(500);
        }
    }
}

/**
 *@}
 **/
